package com.alibaba.fanshe;

import com.alibaba.entity.Annimal;

import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.util.Properties;

/**
 * @Author: zhuangzhiwen
 * @Date: 2021/8/22
 */
public class ReflectTest {
    public static void main(String[] args) throws Exception {

        Properties properties=new Properties();
        ClassLoader classLoader = ReflectTest.class.getClassLoader();
        InputStream is = classLoader.getResourceAsStream("fanshe.properties");
        properties.load(is);

        String className = properties.getProperty("className");
        String methodName = properties.getProperty("methodName");

        Class cla = Class.forName(className);
        Object obj = cla.newInstance();
        Method method = cla.getMethod(methodName);
        method.invoke(obj);

    }
}
